/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Review.test1;

/**
 *
 * @author THIEN
 */
public class ThreadOne implements Runnable{
    Thread t;
    Data d;

    public ThreadOne(Data d) {
        this.d = d;
        t = new Thread(this);
        t.start();

    }

    public void run() {
        //throw new UnsupportedOperationException("Not supported yet.");
        while(true){
            synchronized(this.d){
                if(!d.flag){
                    d.getRandom();
                    d.flag = true;
                }
            }
        }
    }


}
